<template>
	<view>
		<hx-navbar ref="hxnb" :config="config">
			<block slot="max">
				<view class="nav_wrap flex">
					<!-- <view class="back_wrap flex" @click="back">
						<u-icon name="arrow-left" color="#fff" size="36"></u-icon>
					</view> -->
					<view class="page_title">工作台</view>
				</view>
			</block>
		</hx-navbar>

		<view class="main-div">
			<image class="main-bg" src="../../../static/img/lawyerVersion/gzt-bg.png" mode="aspectFill"></image>
			<view class="zhanwei" :style="{'height':statusBarHeight+'rpx'}"></view>
			<view class="m-d">
				<view class="tabdiv flex flex_sb">
					<view class="tab-item" :class="tabIndex==1?'tab-item-sel':''" @click="changmain(1)">
						<image v-if="tabIndex!=1" class="tab-img" src="../../../static/img/lawyerVersion/gzt1-1.png"
							mode=""></image>
						<image v-if="tabIndex==1" class="tab-img" src="../../../static/img/lawyerVersion/gzt1-2.png"
							mode=""></image>
						<view class="tab-text">
							我的案源
						</view>
						<view v-if="tabIndex==1" class="boderred"></view>
					</view>
					<view class="tab-item" :class="tabIndex==2?'tab-item-sel':''" @click="changmain(2)">
						<image v-if="tabIndex!=2" class="tab-img" src="../../../static/img/lawyerVersion/gzt2-1.png"
							mode=""></image>
						<image v-if="tabIndex==2" class="tab-img" src="../../../static/img/lawyerVersion/gzt2-2.png"
							mode=""></image>
						<view class="tab-text">
							我的咨询
						</view>
						<view v-if="tabIndex==2" class="boderred"></view>
					</view>
					<view class="tab-item tab-item2" :class="tabIndex==3?'tab-item-sel':''" @click="changmain(3)">
						<image v-if="tabIndex!=3" class="tab-img" src="../../../static/img/lawyerVersion/gzt3-1.png"
							mode=""></image>
						<image v-if="tabIndex==3" class="tab-img" src="../../../static/img/lawyerVersion/gzt3-2.png"
							mode=""></image>
						<view class="tab-text">
							我的协作任务
						</view>
						<view v-if="tabIndex==3" class="boderred boderred2"></view>
					</view>
					<view class="tab-item" :class="tabIndex==4?'tab-item-sel':''" @click="changmain(4)">
						<image v-if="tabIndex!=4" class="tab-img" src="../../../static/img/lawyerVersion/gzt4-1.png"
							mode=""></image>
						<image v-if="tabIndex==4" class="tab-img" src="../../../static/img/lawyerVersion/gzt4-2.png"
							mode=""></image>
						<view class="tab-text">
							我的需求
						</view>
						<view v-if="tabIndex==4" class="boderred"></view>
					</view>
					<view class="tab-item" :class="tabIndex==5?'tab-item-sel':''" @click="changmain(5)">
						<image v-if="tabIndex!=5" class="tab-img" src="../../../static/img/lawyerVersion/gzt5-1.png"
							mode=""></image>
						<image v-if="tabIndex==5" class="tab-img" src="../../../static/img/lawyerVersion/gzt5-2.png"
							mode=""></image>
						<view class="tab-text">
							我的派单
						</view>
						<view v-if="tabIndex==5" class="boderred"></view>
					</view>
				</view>
			</view>
		</view>
		<!-- <view class="u-p-l-80 u-p-r-80 u-m-t-14" v-if="tabIndex==2">
			<u-tabs :list="list" :is-scroll="false" :current="current" bg-color="#f5f5f6" active-color="#FC3A30"
				@change="change"></u-tabs>
		</view>
		<view class="tab-two flex u-m-t-24" v-if="tabIndex==1 || tabIndex==2">
			<view class="tt-item" v-for="(item,index) in ttlist" :key="index" :class="tabIndex2==index?'tt-item-sel':''"
				@click="zxChange(index)">
				{{item}}
			</view>
		</view> -->

		<view class="or-div" v-if="tabIndex==1">
			<view class="tab-two flex u-m-t-24 u-m-b-24">
				<view class="tt-item" v-for="(item,index) in ttlist" :key="index" :class="tabIndex1==index?'tt-item-sel':''"
					@click="ayChange(index)">
					{{item}}
				</view>
			</view>
			<view class="or-item" v-for="(item,index) in aylist" :key="index"> <!-- aylist -->
				<view class="item-top flex flex_sb">
					<view class="flex" v-if="item.task">
						<image class="i-icon" :src="action+item.task.icon" mode=""></image>
						<view class="font_16_333 font_weight u-m-l-16">
							{{item.task.name}}
						</view>
					</view>
					<view class="flex" v-else-if="item.serve">
						<image class="i-icon" :src="action+item.serve.icon" mode=""></image>
						<view class="font_16_333 font_weight u-m-l-16">
							{{item.serve.name}}
						</view>
					</view>
					<view class="zt" v-if="item.lawyer_serve">
						<span class="" v-if="item.lawyer_serve.serve_status==10">待服务</span>
						<span class="" v-if="item.lawyer_serve.serve_status==20">服务中</span>
						<span class="font_14_333" v-if="item.lawyer_serve.serve_status==30">已完成</span>
						<span class="font_14_666" v-if="item.lawyer_serve.serve_status==40">已关闭</span>
					</view>
					<view class="zt" v-if="!item.lawyer_serve">
						待接入
					</view>
				</view>
				<view class="item-main u-padding-24 ">
					<view class="" v-if="item.user">
						<span class="font_14_666 font_weight">购买用户：</span>
						<span class="font_14_333">{{item.user.name}}</span>
					</view>
					<view class="u-m-t-24 flex_only">
						<span class="font_14_666 font_weight">问题描述：</span>
						<view class="vldiv">
							<view class="line_2">
								{{item.content?item.content:'--'}}
							</view>
							<view class=" font_14_666 u-m-t-14">
								<span v-if="item.lawyer_serve">{{item.lawyer_serve.pay_time}}</span>
								<span class="didian" v-if="item.province_name">{{item.province_name}}</span>
							</view>
						</view>
					</view>
					<!-- 已完成已完成已完成已完成 -->
					<view class="u-m-t-24 flex_only" v-if="item.lawyer_serve && item.lawyer_serve.gallery">
						<view class="font_14_666 font_weight">服务成果：</view>
						<view class="flex vldiv flex_wrap">
							<view class="" v-for="(item2,index2) in item.lawyer_serve.gallery.split(',')" :key="index2">
								<image class="fwcg-img" :src="item2" @click="previewImage(item.lawyer_serve.gallery.split(','))" mode="aspectFill"></image>
							</view>
						</view>
					</view>
				</view>
				<!-- 已完成没有以下 -->
				<view class="or-bottom flex flex_end" v-if="item.lawyer_serve">
					<!-- 待服务待服务待服务 -->
					<view class="btn1" v-if="item.lawyer_serve.serve_status==10" @click="setxiezuo2(20,item)">
						开始服务
					</view>
					<!-- 服务中服务中服务中 -->
					<view class="btn1" v-if="(item.lawyer_serve.serve_status==20 || item.lawyer_serve.serve_status==30) && !item.lawyer_serve.gallery" @click="shangchaun(item.id,2)">
						上传成果
					</view>
				</view>
			</view>
		</view>
		<view class="or-div" v-if="tabIndex==2">
			<view class="u-p-l-80 u-p-r-80" >
				<u-tabs :list="list" :is-scroll="false" :current="current" bg-color="#f5f5f6" active-color="#FC3A30"
					@change="change"></u-tabs>
			</view>
			<view class="tab-two flex u-m-t-24 u-m-b-24">
				<view class="tt-item" v-for="(item,index) in ttlist" :key="index" :class="tabIndex2==index?'tt-item-sel':''"
					@click="zxChange(index)">
					{{item}}
				</view>
			</view>
			<view class="or-item" v-for="(item,index) in zxlist" :key="index"> <!-- zxlist -->
				<view class="item-top flex flex_sb">
				
					<view class="flex" v-if="item.task">
						<image class="i-icon" :src="action+item.task.icon" mode=""></image>
						<view class="font_16_333 font_weight u-m-l-16">
							{{item.task.name}}
						</view>
					</view>
					<view class="flex" v-else-if="item.serve">
						<image class="i-icon" :src="action+item.serve.icon" mode=""></image>
						<view class="font_16_333 font_weight u-m-l-16">
							{{item.serve.name}}
						</view>
					</view>
					<view class="zt" v-if="item.lawyer_serve">
						<span class="" v-if="item.lawyer_serve.serve_status==10">待服务</span>
						<span class="" v-if="item.lawyer_serve.serve_status==20">服务中</span>
						<span class="font_14_333" v-if="item.lawyer_serve.serve_status==30">已完成</span>
						<span class="font_14_666" v-if="item.lawyer_serve.serve_status==40">已关闭</span>
					</view>
				</view>
				<view class="item-main u-padding-24 ">
					<view class="" v-if="item.user">
						<span class="font_14_666 font_weight">购买用户：</span>
						<span class="font_14_333">{{item.user.name}}</span>
					</view>
					<view class="u-m-t-24 flex_only">
						<span class="font_14_666 font_weight"  v-if="item.content">问题描述：</span>
						<view class="vldiv">
							<view class="line_2" v-if="item.content">
								{{item.content}}
							</view>
							<view class=" font_14_666 u-m-t-14">
								<span v-if="item.lawyer_serve">{{item.lawyer_serve.pay_time}}</span>
								<span class="didian" v-if="item.province_name">{{item.province_name}}</span>
							</view>
						</view>
					</view>
					<!-- 已完成已完成已完成已完成 -->
					<view class="u-m-t-24 flex_only" v-if="item.lawyer_serve && item.lawyer_serve.gallery">
						<view class="font_14_666 font_weight">服务成果：</view>
						<view class="flex vldiv flex_wrap">
							<view class="" v-for="(item2,index2) in item.lawyer_serve.gallery.split(',')" :key="index2">
								<image class="fwcg-img" :src="item2" @click="previewImage(item.lawyer_serve.gallery.split(','))" mode="aspectFill"></image>
							</view>
						</view>
					</view>
				</view>
				<!-- 已完成没有以下 -->
				<view class="or-bottom flex flex_end" v-if="item.lawyer_serve">
					<!-- 待服务待服务待服务 -->
					<view class="btn1" v-if="item.lawyer_serve.serve_status==10" @click="setxiezuo2(20,item)">
						开始服务
					</view>
					<!-- 服务中服务中服务中 -->
					<view class="btn1" v-if="(item.lawyer_serve.serve_status==20 || item.lawyer_serve.serve_status==30) && !item.lawyer_serve.gallery" @click="shangchaun(item.id,2)">
						上传成果
					</view>
				</view>
			</view>
		</view>
		<view class="pb200" v-if="tabIndex==3">
			<image class="lvgc-img" src="../../../static/img/lawyerVersion/lvgc.png" mode=""></image>
			<view class="font_weight font_16_333 u-m-l-32">
				我的协作任务
			</view>
			<view class="tab-two flex u-m-t-24">
				<view class="tt-item" v-for="(item,index) in ttlist2" :key="index"
					:class="tabIndex3==index?'tt-item-sel':''" @click="xzchange(index)">
					{{item}}
				</view>
			</view>
			<view class="or-div">
				<view class="or-item" v-for="(item,index) in xzlist" :key="index">
					<view class="item-top flex flex_sb">
						<view class="flex" >
							<image v-if="item.serve" class="i-icon" :src="action+item.serve.icon" mode="aspectFill"></image>
							<view v-if="item.serve" class="font_16_333 font_weight u-m-l-16" >
								{{item.serve.name}}
							</view>
						</view>
						<view class="zt">
							 <!-- //0全部 20代服务 25服务中 30待评价 40已完成 50已关闭 -->
							<span class="" v-if="item.status==20">待服务</span>
							<span class="" v-if="item.status==25">服务中</span>
							<span class="" v-if="item.status==30">待评价</span>
							<span class="font_14_333" v-if="item.status==40">已完成</span>
							<span class="font_14_666" v-if="item.status==50">已关闭</span>
						</view>
					</view>
					<view class="item-main u-p-l-24 u-p-r-24 u-p-b-24">
						<view class="">
							{{item.info}}
						</view>
						<view class="u-m-t-24 flex_only" v-if="item.gallery">
							<view class="font_14_666 font_weight">服务成果：</view>
							<view class="flex vldiv flex_wrap">
								<view class="" v-for="(item2,index2) in item.gallery" :key="index2">
									<image class="fwcg-img" :src="item2" @click="previewImage(item.gallery)" mode="aspectFill"></image>
								</view>
							</view>
						</view>
						<view class="flex u-m-t-26">
							<u-icon name="map" color="#272636" size="28"></u-icon>
							<view class="u-m-l-10">
								{{item.province.name}}
							</view>
							<view class="font_12_666 u-m-l-10">
								{{item.created_at}}
							</view>
						</view>
					</view>
					<!-- 已完成没有以下 -->
					<view class="or-bottom flex flex_sb u-p-l-24">
						<view class="font_weight">
							￥ <span class="u-font-40">{{item.price}}</span>  
						</view>
						<view class=" flex flex_end">
							<!-- 待服务待服务待服务 -->
							<view class="btn1" @click="setxiezuo(25,item.id)" v-if="item.status==20">
								设置为服务中
							</view>
							<!-- 服务中服务中服务中 -->
							<view class="btn1" @click="setxiezuo(30,item.id)" v-if="item.status==25">
								确认完成
							</view>
							<!-- 待评价待评价待评价待评价 -->
							<view class="btn1" @click="pingjia(item.id)" v-if="item.status==30">
								去评价
							</view>
						</view>
					</view>
					
				</view>
			</view>
			<view class="fb-btn" @click="$u.throttle(fabu(1), 1000)">
				发布协作任务
			</view>
		</view>
		
		<view class="pb200" v-if="tabIndex==4">
			<view class="u-m-t-32 u-m-l-32 flex">
				<view class="font_weight font_16_333">
					我的需求
				</view>
				<view class="font_12_999 u-m-l-16">
					海量律师/法学生协作
				</view>
			</view>
			<view class="or-div">
				<view class="or-item" v-for="(item,index) in xqlist" :key="index">
					<view class="item-top flex flex_sb">
						<view class="font_16_333 font_weight">
							{{item.task.name}}
						</view>
						<view class="zt">
							<!-- status 10待接单 20待服务 25服务中 30待评价 40已完成 50已关闭 -->
							<span class="font_14_666" v-if="item.status==10" >匹配中…</span>
							<span class="" v-else-if="item.status==20">已确认</span>
							<span class="" v-else-if="item.status==25">服务中</span>
							<span class="" v-else-if="item.status==30">待评价</span>
							<span class="" v-else-if="item.status==40">已完成</span>
							<span class="font_14_666" v-else-if="item.status==50">已关闭</span>
						</view>
					</view>
					<view class="item-main u-p-l-24 u-p-r-24 u-p-b-24">
						<view class="">
							{{item.info}}
						</view>
						<view class="flex flex_sb">
							<view class="flex u-m-t-26">
								<u-icon v-if="item.province" name="map" color="#272636" size="28"></u-icon>
								<view class="u-m-l-10" v-if="item.province">
									{{item.province.name}}
								</view>
								<view class="font_12_666 u-m-l-10">
									{{item.time}}
								</view>
							</view>
							<view class="font_weight">
								￥ <span class="u-font-40">{{item.price}}</span>  
							</view>
						</view>
						
					</view>
					<view class="or-bottom flex flex_end" v-if="item.status==10">
						<view class="btn2" @click="xqcan(item)">
							取消订单
						</view>
					</view>
					<view class="or-bottom flex flex_sb u-p-l-24 u-p-r-24" v-else>
						<view class="flex" v-if="item.r_user">
							<image class="i-icon2" :src="item.r_user.avatar" mode="aspectFill"></image>
							<view class="font_12_666 u-m-l-16">
								{{item.r_user.name}}
							</view>
						</view>
						<view class="font_12_666">
							{{item.time}}
						</view>
					</view>
				</view>
			</view>
			<view class="fb-btn" @click="$u.throttle(fabu(2), 1000)">
				发布需求
			</view>
		</view>
		<view class="" v-if="tabIndex==5">
			<view class="u-m-t-32 u-m-l-32 flex">
				<view class="font_weight font_16_333">
					我的派单
				</view>
				<view class="font_12_999 u-m-l-16">
					海量真实案源
				</view>
			</view>
			<view class="tab-two flex u-m-t-24">
				<view class="tt-item" v-for="(item,index) in ttlist" :key="index"
					:class="tabIndex4==index?'tt-item-sel':''"  @click="pdchange(index)">
					{{item}}
				</view>
			</view>
			<view class="or-div">
				<view class="or-item" v-for="(item,index) in pdlist" :key="index">
					<view class="item-top flex flex_sb">
						<view class="flex">
							<image class="i-icon" :src="action+item.task.icon" mode="aspectFill"></image>
							<view class="font_16_333 font_weight u-m-l-16">
								{{item.task.name}}
							</view>
						</view>
						<view class="zt">
							<!-- //0全部 20代服务 25服务中 30待评价 40已完成 50已关闭 -->
							<span class="" v-if="item.status==20">待服务</span>
							<span class="" v-if="(item.status==25 || item.status==30) && !item.gallery">服务中</span>
							<!-- <span class="" v-if="item.status==30">待评价</span> -->
							<span class="font_14_333" v-if="item.status==40 || item.gallery">已完成</span>
							<span class="font_14_666" v-if="item.status==50">已关闭</span>
						</view>
					</view>
					<view class="item-main u-p-l-24 u-p-r-24 u-p-b-24">
						<view class="">
							{{item.info}}
						</view>
						<view class="flex u-m-t-26">
							<u-icon name="map" color="#272636" size="28"></u-icon>
							<view class="u-m-l-10">
								{{item.province.name}}
							</view>
							<view class="font_12_666 u-m-l-10">
								{{item.created_at}}
							</view>
						</view>
					</view>
					<!-- 已完成没有以下 -->
					<view class="or-bottom flex flex_sb u-p-l-24">
						<view class="font_weight">
							￥ <span class="u-font-40">{{item.price}}</span>  
						</view>
						<view class=" flex flex_end">
							<!-- 待服务待服务待服务 -->
							<view class="btn1"  v-if="item.status==20"  @click="setxiezuo(25,item.id)">
								开始服务
							</view>
							<!-- 服务中服务中服务中 -->
							<view class="btn1" v-if="(item.status==25 || item.status==30) && !item.gallery" @click="shangchaun(item.id,1)">
								上传成果
							</view>
							
						</view>
					</view>
					
				</view>
			</view>
		</view>
		<serverTime></serverTime>
		<u-tabbar active-color="#FA3B21" :list="tabbar"></u-tabbar>
	</view>
</template>

<script>
	import TIM from '@/TXIM/static/IM-SDK/tim-wx.js'
	var statusBarHeight = (uni.getSystemInfoSync().statusBarHeight * 2);
	import serverTime from '../../../components/serverTime/serverTime.vue';
	export default {
		components: {
			serverTime
		},
		data() {
			return {
				statusBarHeight: statusBarHeight,
				config: {
					maxSlot: true,
					back: false,
					barPlaceholder: false,
					backgroundColor: [0, '#F87D85'],
					slideBackgroundColor: [1, '#F87D85']
				},
				tabbar: '',

				tabIndex: 1,
				tabIndex1: 0,
				tabIndex2: 0,
				tabIndex3:0,
				tabIndex4:0,
				ttlist: ['全部', '待服务', '服务中', '已完成', '已关闭'],
				ttlist2: ['全部', '待服务', '服务中', '待评价', '已完成', '已关闭'],

				list: [{
					name: '在线咨询'
				}, {
					name: '预约咨询'
				}],
				current: 0,
				aylist:[],
				zxlist:[],
				xzlist:[],
				xqlist:[],
				pdlist:[],
				type:'online',//online 在线咨询 appointment预约咨询
				status:0 ,//0全部 10待处理 20服务中 30已完成 40已关闭
				
				xzstatus:0 ,//0全部 20代服务 25服务中 30待评价 40已完成 50已关闭
				zxstatus:0,
				aystatus:0,
				pdstatus:0,
				action:'',
				
				total:0,
				pageNum:1,
				pageSize:20,
			}
		},
		onLoad() {
			this.action = this.$config.imgUrl
			this.tabbar = [{
				iconPath: "/static/img/tabBar/1-2.png",
				selectedIconPath: "/static/img/tabBar/1-1.png",
				text: '首页',
				pagePath: "/subPackageA/pages/lawyerVersion/index/index"
			}, {
				iconPath: "/static/img/tabBar/2-2-2.png",
				selectedIconPath: "/static/img/tabBar/2-2-1.png",
				text: '工作台',
				// count: 2,
				isDot: true,
				pagePath: "/subPackageA/pages/lawyerVersion/staging/staging"
			}, {
				iconPath: "/static/img/tabBar/4-1.png",
				selectedIconPath: "/static/img/tabBar/4-2.png",
				text: '消息',
				// count: 2,
				isDot: false,
				pagePath: "/subPackageA/pages/lawyerVersion/message/message"
			}, {
				iconPath: "/static/img/tabBar/5-2.png",
				selectedIconPath: "/static/img/tabBar/5-1.png",
				text: '我的',
				pagePath: "/subPackageA/pages/lawyerVersion/mine/mine"
			}]
			this.getInfo()
			
		},
		onShow() {
			this.pageNum = 1
			this.anyuan()
			this.zixun()
			this.xiezuo()
			this.xuqiu()
			this.paidan()
		},
		onPageScroll(e) {
			// 重点，用到滑动切换必须加上
			this.$refs.hxnb.pageScroll(e);
		},
		onReachBottom() {
			if (this.pageNum * this.pageSize > this.total) {
				// uni.hideNavigationBarLoading();
			} else {
				this.pageNum++;
				if(this.tabIndex==1){
					this.anyuan()
				}else if(this.tabIndex==2){
					this.zixun()
				}else if(this.tabIndex==3){
					this.xiezuo()
				}else if(this.tabIndex==4){
					this.xuqiu()
				}else if(this.tabIndex==5){
					this.paidan()
				}
			}
		},
		methods: {
			previewImage(url) {
				uni.previewImage({
					urls: url
				})
			},
			// 个人信息
			getInfo() {
				this.$api({
					url: '/getUserInfo',
					method: 'get',
					data: {
						token: uni.getStorageSync("token")
					},
				}).then(res => {
					if (res.code == 1) {
						this.$api({
							url: '/user/getImUserSign',
							method: 'post',
							data: {
								token: uni.getStorageSync("token"),
								user_id: res.data.id
							},
						}).then(res => {
							if (res.code == 1) {
								this.tim.login({
									userID: res.data.userId, //登录时的用户ID
									userSig: res.data.userSign
								}).then(function(imResponse) {
									console.log("登录结果", imResponse)
								})
							}
						})
					}
				})
			},
			
			changmain(e){
				this.pageNum = 1
				 this.tabIndex=e
				 this.status=''
			}, 
			xqcan(e){
				let that = this
				let tishi = '确认取消需求吗'
				
				uni.showModal({
					title: '提示',
					content: tishi,
					success: function(res) {
						if (res.confirm) {
							that.$api({
								url: '/lawyer/cancel_demand',
								method: 'post',
								data: {
									token:uni.getStorageSync("token"),
									id:e.id,
								},
							}).then(res => {
								if (res.code == 1) {
									uni.showToast({
										title: "取消成功",
										icon: "none"
									});
									
									that.xuqiu()
								} 
							})
							
							
						}
					}
				});
				
			},
			anyuan(){
				this.$api({
					url: '/lawyer/my_case_list',
					method: 'get',
					data: {
						page:this.pageNum,
						limit:this.pageSize,
						token:uni.getStorageSync("token"),
						// type:this.type,
						status:this.aystatus
					},
				}).then(res => {
					if (res.code == 1) {
						// this.aylist = res.data.data
						
						this.total=res.data.total
						let data = res.data.data
						if (this.pageNum == 1) {
							this.aylist = data
						} else {
							this.aylist = [...this.aylist, ...data]
						}
					} 
				})
			},
			zixun(){
				this.$api({
					url: '/lawyer/worktop_seek',
					method: 'get',
					data: {
						page:this.pageNum,
						limit:this.pageSize,
						token:uni.getStorageSync("token"),
						type:this.type,
						status:this.zxstatus
					},
				}).then(res => {
					if (res.code == 1) {
						// this.zxlist = res.data.data
						
						this.total=res.data.total
						let data = res.data.data
						if (this.pageNum == 1) {
							this.zxlist = data
						} else {
							this.zxlist = [...this.zxlist, ...data]
						}
					} 
				})
			},
			xiezuo(){
				this.$api({
					url: '/lawyer/my_coll',
					method: 'get',
					data: {
						token:uni.getStorageSync("token"),
						page:this.pageNum,
						limit:this.pageSize,
						status:this.xzstatus
					},
				}).then(res => {
					if (res.code == 1) {
						// this.xzlist = res.data.data
						
						this.total=res.data.total
						let data = res.data.data
						if (this.pageNum == 1) {
							this.xzlist = data
						} else {
							this.xzlist = [...this.xzlist, ...data]
						}
					} 
				})
			},
			xuqiu(){
				this.$api({
					url: '/lawyer/my_demand',
					method: 'get',
					data: {
						token:uni.getStorageSync("token"),
						page:this.pageNum,
						limit:this.pageSize,
					},
				}).then(res => {
					if (res.code == 1) {
						// this.xqlist = res.data.data
						
						this.total=res.data.total
						let data = res.data.data
						if (this.pageNum == 1) {
							this.xqlist = data
						} else {
							this.xqlist = [...this.xqlist, ...data]
						}
					} 
				})
			},
			paidan(){
				this.$api({
					url: '/lawyer/my_dispatch',
					method: 'get',
					data: {
						token:uni.getStorageSync("token"),
						page:this.pageNum,
						limit:this.pageSize,
						status:this.pdstatus
					},
				}).then(res => {
					if (res.code == 1) {
						// this.pdlist = res.data.data
						
						this.total=res.data.total
						let data = res.data.data
						if (this.pageNum == 1) {
							this.pdlist = data
						} else {
							this.pdlist = [...this.pdlist, ...data]
						}
					} 
				})
			},
			pdchange(index){
				this.pageNum = 1
				this.tabIndex4=index
				if(this.tabIndex4==0){
					this.pdstatus = '0'
				}
				if(this.tabIndex4==1){
					this.pdstatus = '20'
				}
				if(this.tabIndex4==2){
					this.pdstatus = '25'
				}
				if(this.tabIndex4==3){
					this.pdstatus = '30'
				}
				// if(this.tabIndex4==4){
				// 	this.pdstatus = '40'
				// }
				if(this.tabIndex4==5){
					this.pdstatus = '50'
				}
				this.paidan()
			},
			xzchange(e){
				this.pageNum = 1
				this.tabIndex3=e
				//0全部 20代服务 25服务中 30待评价 40已完成 50已关闭
				if(this.tabIndex3==0){
					this.xzstatus = '0'
				}
				if(this.tabIndex3==1){
					this.xzstatus = '20'
				}
				if(this.tabIndex3==2){
					this.xzstatus = '25'
				}
				if(this.tabIndex3==3){
					this.xzstatus = '30'
				}
				if(this.tabIndex3==4){
					this.xzstatus = '40'
				}
				if(this.tabIndex3==5){
					this.xzstatus = '50'
				}
				this.xiezuo()
			},
			fabu(e){
				// if(e==1){
					uni.navigateTo({
						url:"/subPackageA/pages/lawyerVersion/staging/pushNeedXiezuo?type="+e
					})
				// }else{
				// 	uni.navigateTo({
				// 		url:"/subPackageA/pages/lawyerVersion/staging/pushNeed?type="+e
				// 	})
				// }
				
			},
			// shangchaun(id){
			// 	uni.navigateTo({
			// 		url:"/subPackageA/pages/lawyerVersion/staging/uploadResult?id="+id
			// 	})
			// },
			shangchaun(id,type){
				uni.navigateTo({
					url:"/subPackageA/pages/lawyerVersion/staging/uploadResult?id="+id+"&type="+type
				})
			},
			pingjia(e){
				uni.navigateTo({
					url:"/subPackageA/pages/lawyerVersion/staging/pingjia?id="+e+"&type=2"
				})
			},
			tochat(){
				uni.navigateTo({
					url:"/pages/consultation/chat"
				})
			},
			change(index) {
				this.pageNum = 1
				this.current = index;
				if(this.current==0){
					this.type = 'online'
				}
				if(this.current==1){
					this.type = 'appointment'
				}
				this.zixun()
			},
			zxChange(e){
				this.pageNum = 1
				// 0全部 10待处理 20服务中 30已完成 40已关闭
				this.tabIndex2=e
				if(this.tabIndex2==0){
					this.zxstatus = '0'
				}
				if(this.tabIndex2==1){
					this.zxstatus = '10'
				}
				if(this.tabIndex2==2){
					this.zxstatus = '20'
				}
				if(this.tabIndex2==3){
					this.zxstatus = '30'
				}
				if(this.tabIndex2==4){
					this.zxstatus = '40'
				}
				
				this.zixun()
			},
			ayChange(e){
				this.pageNum = 1
				this.tabIndex1=e
				if(this.tabIndex1==0){
					this.aystatus = ''
				}
				if(this.tabIndex1==1){
					this.aystatus = '10'
				}
				if(this.tabIndex1==2){
					this.aystatus = '20'
				}
				if(this.tabIndex1==3){
					this.aystatus = '30'
				}
				if(this.tabIndex1==4){
					this.aystatus = '40'
				}
				
				this.anyuan()
			},
			setxiezuo(e,id){
				let that = this
				let tishi = '确认设置为服务中吗'
				if(e==25){
					
				}
				if(e==30){
					tishi = '确认设置为完成吗'
				}
				uni.showModal({
					title: '提示',
					content: tishi,
					success: function(res) {
						if (res.confirm) {
							that.$api({
								url: '/lawyer/change_coll_status',
								method: 'post',
								data: {
									token:uni.getStorageSync("token"),
									id:id,
									status:e
								},
							}).then(res => {
								if (res.code == 1) {
									uni.showToast({
										title: "设置成功",
										icon: "none"
									});
									that.pageNum = 1
									that.xiezuo()
									that.paidan()
								} 
							})
							
						}
					}
				});
				
			},
			setxiezuo2(e,item){
				let that = this
				
				uni.showModal({
					title: '提示',
					content: '确认开始服务吗',
					success: function(res) {
						if (res.confirm) {
							that.$api({
								url: '/lawyer/other_change_status',
								method: 'post',
								data: {
									token:uni.getStorageSync("token"),
									id:item.id,
									status:e
								},
							}).then(res => {
								if (res.code == 1) {
									uni.showToast({
										title: "开始服务",
										icon: "none"
									});
									
									that.pageNum = 1
									that.anyuan()
									that.zixun()
									
									
									let promise = {
										conversationID: 'C2C'+item.user.im_id,
										userProfile: {
											nick: item.user.name,
											avatar: item.user.image,
											userID: item.user.im_id,
										}
									}
									uni.$on('send', () => {
										uni.$emit("conversationData", promise);
									})
									uni.navigateTo({
										url: '/TXIM/pages/chat/chat'
									})
								} 
							})
							
						}
					}
				});
				
			},
		}
	}
</script>

<style scoped lang="scss">
	.pb200{
		padding-bottom: 100rpx;
	}
	.lvgc-img {
		width: 686rpx;
		height: 176rpx;
		margin: 32rpx;
		background-color: #eee;
	}
	.fb-btn{
		width: 686rpx;
		height: 92rpx;
		background: linear-gradient( 180deg, #FA2D2D 0%, #F40000 100%);
		border-radius: 46rpx 46rpx 46rpx 46rpx;
		font-weight: 500;
		font-size: 36rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 92rpx;
		position: fixed;
		bottom: 180rpx;
		left: 32rpx;
	}
	.nav_wrap {
		width: 100%;
		position: relative;

		.back_wrap {
			position: absolute;
			left: 24rpx;

			.diqu {
				font-weight: 600;
				font-size: 32rpx;
				color: #FFFFFF;
				margin: 0 12rpx;
			}

			.dq-icon {
				width: 28rpx;
				height: 34rpx;
			}
		}

		.page_title {
			width: 100vw;
			text-align: center;
			font-weight: bold;
			font-size: 36rpx;
			color: #FFFFFF;
		}
	}

	.main-div {
		position: relative;
		width: 100%;
		height: 344rpx;
		display: flex;
		flex-direction: column;

		.main-bg {
			width: 100%;
			height: 344rpx;
			position: absolute;
			top: 0;
			z-index: 0;
		}

		.zhanwei {
			width: 100%;
		}
	}

	.m-d {
		position: relative;
		padding-top: 88rpx;
		z-index: 2;
		padding-bottom: 40rpx;
		width: 100%;
		// height: 344rpx;
		flex: 1; /* 这会使子元素填满剩余空间 */

		.tabdiv {
			position: absolute;
			width: 100%;
			bottom: 0;
			padding: 0 32rpx;

			.tab-item {
				width: 120rpx;
				height: 150rpx;
				padding-top: 16rpx;
				position: relative;

				&2 {
					width: 164rpx;
				}

				.tab-img {
					width: 56rpx;
					height: 56rpx;
					margin: 0 auto;
				}

				.tab-text {
					font-size: 24rpx;
					color: #FFFFFF;
					text-align: center;
					margin-top: 14rpx;
				}

				.boderred {
					width: 72rpx;
					height: 6rpx;
					background: #F62C10;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					position: absolute;
					bottom: 0;
					left: 24rpx;
					margin: 0 auto;
					
					&2{
						left: 46rpx;
					}
				}

				&-sel {
					background: linear-gradient(180deg, #FFECEA 0%, #FFFFFF 100%);
					border-radius: 16rpx 16rpx 0rpx 0rpx;

					.tab-text {
						font-size: 24rpx;
						color: #F62C10;
					}
				}
			}
		}
	}

	.tab-two {
		width: 696rpx;
		// height: 72rpx;
		background: #EDEDF2;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		margin: 0 auto;
		padding: 8rpx;

		.tt-item {
			width: 144rpx;
			height: 56rpx;
			text-align: center;
			line-height: 56rpx;

			&-sel {

				background: #FFFFFF;
				border-radius: 8rpx 8rpx 8rpx 8rpx;

			}
		}
	}

	.or-div {
		padding: 32rpx;

		.or-item {
			width: 686rpx;
			// height: 568rpx;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-bottom: 32rpx;

			.item-top {
				padding: 24rpx;
				// border-bottom: 2rpx solid #F1F1F1;

				.i-icon {
					width: 48rpx;
					height: 48rpx;
				}
				
				.zt {
					font-weight: 600;
					font-size: 28rpx;
					color: #FC3A30;
				}
			}
			.i-icon2{
				width: 48rpx;
				height: 48rpx;
				border-radius: 50%;
				background-color: #eee;
			}
			.item-main {
				

				.didian {
					border-left: 1px solid #C4C4C4;
					padding-left: 12rpx;
					margin-left: 12rpx;
				}


			}

			.or-bottom {
				height: 100rpx;
				border-top: 2rpx solid #F1F1F1;
				padding-right: 24rpx;

				.btn1 {
					width: 160rpx;
					height: 64rpx;
					background: linear-gradient(180deg, #FA2D2D 0%, #F40000 100%);
					border-radius: 36rpx 36rpx 36rpx 36rpx;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 64rpx;
					text-align: center;
					margin-left: 16rpx;
				}

				.btn2 {
					width: 160rpx;
					height: 64rpx;
					border-radius: 32rpx 32rpx 32rpx 32rpx;
					border: 2rpx solid #ADADAD;
					font-size: 28rpx;
					color: #666666;
					line-height: 64rpx;
					text-align: center;
					margin-left: 16rpx;
				}
			}
		}
	}
	.fwcg-img {
		width: 150rpx;
		height: 150rpx;
		border-radius: 16rpx;
		margin-right: 4rpx;
	}
	
	.vldiv {
		width: 480rpx;
	}
</style>